/****************************************************
          File Name:13-1.cpp
          Author: Abby Cin
          Mail: abbytsing@gmail.com
          Created Time: Sat 03 Jan 2015 04:38:02 PM CST
*****************************************************/

#include "13-1.h"
#include <iostream>
using namespace std;

void Bravo(const Cd & disk)
{
    disk.Report();
}

int main()
{
    Cd c1("Beatles", "Capitol", 14, 35.5);
    Classic c2 = Classic("Piano Sonata in B flat, Fantasia in C", 
            "Alfred Brendel", "Pilips", 2, 57.17);
    Cd *pcd = &c1;

    cout << "using object directly:\n";
    c1.Report();
    c2.Report();

    cout << "Using cd pointer to object:\n";
    pcd->Report();
    pcd = &c2;                  // implicit up conversion: base class to derived class
    pcd->Report();

    cout << "Calling a function with a Cd reference argument:\n";
    Bravo(c1);
    Bravo(c2);

    cout << "Testing argument: \n";
    Classic copy;
    copy = c2;              // inheirt Cd::operator=()
    copy.Report();

    return 0;
}
